package cn.lyjuan.first.netty.demo._3_netty5.client;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import io.netty.channel.SimpleChannelInboundHandler;

import java.net.SocketAddress;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class ClientHandler extends SimpleChannelInboundHandler<String>
{
    protected void messageReceived(ChannelHandlerContext channelHandlerContext, String msg) throws Exception
    {
        System.out.println("client messageReceived: " + msg);
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
    {
        System.out.println("client exceptionCaught");
        super.exceptionCaught(ctx, cause);
    }

    @Override
    public void connect(ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) throws Exception
    {
        System.out.println("client connect");
        super.connect(ctx, remoteAddress, localAddress, promise);
    }

    @Override
    public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception
    {
        System.out.println("client disconnect");
        super.disconnect(ctx, promise);
    }
}
